<?php
require_once 'BaseController.php';

/**
 * 【SP版】路線変更 コントローラ
 */
class Mobileapi_LineChangeController extends Mobileapi_BaseController
{

    /**
     * メインアクション(post)
     */
    public function postAction()
    {
        $params = $this->getParameters();
        $area = substr($params['target_0'], 0, 2);

        $this->makeTemplateParams1($area);
        $this->_data['Mapping_params'] = $params;
        $this->displayBody2('index');
    }

    private function makeTemplateParams1($area_code)
    {
        $this->getPrefData($area_code);

        $model = new Search_Model_Selensen();
        $params = array();
        $params['PrefCd'][] = $area_code;

        $data = array();
        $data["selensen"] = $model->getEnsenDataByMulti($params);
        $model->convertEnsenDataByMulti($data);

        $this->_data['Mapping'] = $data["Mapping"];
        $this->_data['Mapping_area'] = $this->_data['PrefName'];
    }

    public function getPrefData($code)
    {
        $model = new Search_Model_Selareasearch();
        $this->_data['PrefCd'] = $code;
        $this->_data['PrefInfo'] = $model->getSimpleArea($code);
        $this->_data['PrefName'] = $this->getPrefName($code);
        $this->_data['PrefNameJP'] = $this->getPrefNameJP($code);
    }

}
?>